﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity.Car_Rental;

namespace Data.Car_Rental
{
    public class WebAccountBalancesRepository : Car_RentalRepositoryBase, IWebAccountBalancesRepository
    {

        #region IRepository<WebAccountBalances> 成员

        public void Update(WebAccountBalances entity)
        {
            base.UpdateEntity(entity);
        }

        public void Update(IList<WebAccountBalances> list)
        {
            base.UpdateEntity(list.Cast<Entity.EntityBase>().ToList());
        }

        public void Insert(WebAccountBalances entity)
        {
            base.InsertEntity(entity);
        }

        public void Insert(IList<WebAccountBalances> list)
        {
            base.InsertEntity(list.Cast<Entity.EntityBase>().ToList());
        }

        public WebAccountBalances InsertGetIDENTITY(WebAccountBalances entity)
        {
            base.InsertEntity(entity);
            return this.Find(entity.PrimaryKey);
        }

        public void Delete(WebAccountBalances entity)
        {
            base.DeleteEntity(entity);
        }

        public void Delete(IList<WebAccountBalances> list)
        {
            base.DeleteEntity(list.Cast<Entity.EntityBase>().ToList());
        }

        public IQueryable<WebAccountBalances> GetModel()
        {
            return base.GetEntities<WebAccountBalances>().Select(item => new WebAccountBalances_Ext
            {
                BankAcountBalance = item.BankAcountBalance,
                NotAvailableBalance = item.NotAvailableBalance,
                TotalAccountBalance = item.TotalAccountBalance,
                UpdateDate = item.UpdateDate,
                WebAccountBalanceID = item.WebAccountBalanceID,
            });
        }

        public WebAccountBalances Find(params object[] keyValues)
        {
            return base.Find<WebAccountBalances>(keyValues);
        }

        #endregion
    }
}
